import { defineStore } from 'pinia'

export const storeData = defineStore("dataStore",{
  // 数据 长久保存与localStorage
  persist: {
    key: 'userinfo',
    storage: localStorage,
    paths: ['userinfo'],    //指定要长久化的字段
  },
  state: () =>{
    return{
      userinfo: {username:'',avatar:'',}, // 用户的信息
    }
  },
  actions:{
    userinfoNull(){
      this.userinfo = {username:'',avatar:'',}
    },
  },
  getters:{

  }

})

